import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ManagerCarsIndex from '@/views/ManagerCars/ManagerCarsIndex.vue'
import CarsManager from '@/views/ManagerCars/CarsManager.vue'
import RoutePush from '@/views/ManagerCars/RoutePush.vue'
import RouteEdit from '@/views/ManagerCars/RouteEdit.vue'
import UserCenter from '@/views/my/index.vue'


const router = createRouter({
	history: createWebHashHistory(import.meta.env.BASE_URL),
	routes: [
		{
			path: '/',
			redirect: '/home'
		},
		{
			path: '/home',
			name: 'home',
			redirect: '/home/find',
			component: HomeView,
			children: [
				{
					path: 'find',
					name: 'Findsource',
					component: () => import('../views/find/index.vue'),

				},

				{
					path: 'managercars',
					name: 'ManagerCars',
					component: ManagerCarsIndex,
					redirect: '/home/managercars/index',
					children: [
						{
							path: 'index',
							name: 'carsmanager',
							component: CarsManager,
						}, {

							path: 'routepush',
							name: 'routepush',
							component: RoutePush,

						}, {

							path: 'routeedit',
							name: 'routeedit',
							component: RouteEdit,
						}
					]
				},
				{
					path: 'my',
					name: "userCenter",
					// route level code-splitting
					// this generates a separate chunk (About.[hash].js) for this route
					// which is lazy-loaded when the route is visited.
					component: UserCenter,

				},
				{
					path: 'finddetail',
					name: 'finddetail',
					component: () => import('../views/find/detail.vue'),
					meta: {
						isshow: false
					}
				},

			]
		},

		{
			path: '/login',
			name: 'login',
			component: () => import('../views/login/login.vue')
		},
		{
			path: '/register',
			name: 'register',
			component: () => import('../views/register/register.vue'),
			children: [
				{
					path: 'regstep1',
					name: 'regstep1',
					component: () => import('../views/register/step1.vue')
				},
				{
					path: 'regstep2',
					name: 'regstep2',
					component: () => import('../views/register/step2.vue')
				},
			],
			redirect: '/register/regstep1',
		},
		{
			path: '/forget',
			name: 'forget',
			component: () => import('../views/forget/forget.vue'),
			children: [
				{
					path: 'forgetstep1',
					name: 'forgetstep1',
					component: () => import('../views/forget/step1.vue')
				},
				{
					path: 'forgetstep2',
					name: 'forgetstep2',
					component: () => import('../views/forget/step2.vue')
				},
			],
			redirect: '/forget/forgetstep1',
		},
		{
			path: '/about',
			name: 'about',
			component: () => import('../views/AboutView.vue'),
		},
		{
			path: '/wallet',
			name: "myWallet",
			component: () => import('../views/wallet/index.vue'),
		},
		{
			path: '/message',
			name: "message",
			component: () => import('../views/message/index.vue'),
		},
		{
			path: '/msgdetail',
			name: 'msgdetail',
			component: () => import('../views/msgdetail/index.vue'),
		},
		{
			path: '/myorder',
			name: 'myorder',
			component: () => import('../views/myorder/index.vue')	
		},
		{
			path: '/orderdetail',
			name: 'orderdetail',
			component: () => import('../views/orderdetail/index.vue')
			
		},
		{
			path: '/setting',
			name: 'setting',
			component: () => import('../views/setting/index.vue'),
		},
		{
			path: '/feedback',
			name: 'feedback',
			component: () => import('../views/feedback/index.vue'),
		}, {
			path: '/marketing',
			name: 'marketing',
			component: () => import('../views/marketing/index.vue'),
		},
		{
			path: '/confirmscore',
			name: 'confirmscore',
			component: () => import('../views/marketing/confirm.vue')
		},
		{
			path: '/scoreresult',
			name: 'scoreresult',
			component: () => import('../views/marketing/result.vue')
		}




	],
})

export default router
